package com.chapter.sample.redis.iomultiplex.nio;

import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.Scanner;

public class RedisClient02 {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",6389);

        OutputStream outputStream = socket.getOutputStream();
        while (true){
            Scanner scanner = new Scanner(System.in);
            String str = scanner.next();
            if (str.equalsIgnoreCase("quit")){
                break;
            }
            socket.getOutputStream().write(str.getBytes());
            System.out.println("--------RedisClient02 input quit keyword to finish .......");
        }

        outputStream.close();
        socket.close();
    }
}
